package encryption

import (
	"crypto/md5"
	"fmt"
)

// Hash 讲字符串进行md5加密
func Hash(pwd []byte) (string, error) {
	//SHA512算法.
	hash := md5.New()
	_, err := hash.Write([]byte(pwd))
	if err != nil {
		return "", err
	}
	return fmt.Sprintf("%x", hash.Sum(nil)), nil
}
